package Singleton;

/**
 * @ProjectName: 23种设计模式
 * @Package: Singleton
 * @ClassName: Mgr01
 * @Author: renhan
 * @Description:
 * @Date: 2020/11/10 15:34
 * @Version: 1.0
 *
 * 饿汉式
 * 任何时间都会被创建
 */
public class Mgr01 {
    private static final Mgr01 INSTANCE = new Mgr01();

    private Mgr01(){};
    public static Mgr01 getInstance(){ return INSTANCE;}

    public  void m() {System.out.println("m");}

    public static  void main(String[] args){
        Mgr01 m1 = Mgr01.getInstance();
        Mgr01 m2 = Mgr01.getInstance();
        System.out.println(m1 == m2);
    }

}
